<?php

namespace Yj\Crontab;

use App\Controller\Test\testController;
use Hyperf\Di\Annotation\Inject;

class CrontabService
{

    /**
     * @Inject()
     * @var Executor
     */
    protected $executor;

    public function run(){
        $crontab = new Crontab();
        $crontab->setCallback([
           testController::class,'test'
        ]);
        $crontab->setType('callback');
        $crontab->setEnable(true);
        $crontab->setName('test');
        $crontab->setRule('* * * * * *');
        $this->executor->execute($crontab);

    }
}